package com.qysoft.dtkj.dtkj_gl.actions.xtwh;


import java.util.List;

import com.jfinal.aop.Before;
import com.jfinal.aop.Clear;
import com.qysoft.dtkj.dtkj_gl.services.xtwh.JGGLService;
import com.qysoft.rapid.actions.JsonResultInterceptor;
import com.qysoft.rapid.actions.RapidAction;
import com.qysoft.rapid.core.RapidDbConn;
import com.qysoft.rapid.core.RapidDbConnTx;
import com.qysoft.rapid.domain.Bean;

@Before(JsonResultInterceptor.class)
public class JGGLAction extends RapidAction {
	
	@Clear(JsonResultInterceptor.class)
	public void index(){
		bindCurrentRyxxToPage();
		renderJsp("/WEB-INF/pages/xtwh/jggl.jsp");
	}
	
	@Before(RapidDbConnTx.class)
	public void delete() throws Exception{
		String jgid = getPara("jgid");
		JGGLService.delete(jgid);
	}
	
	@Before(RapidDbConnTx.class)
	public void saveJGXX() throws Exception{
		Bean jgxx = getBean();
		JGGLService.saveJGXX(jgxx);
	}
	
	@Before(RapidDbConn.class)
	public void queryJGXX() throws Exception{
		String jgid = getPara("id");
		Bean jgxx = JGGLService.queryJGXX(jgid);
		setJson(jgxx);
	}
	
	@Before(RapidDbConnTx.class)
	public void updateJGXX() throws Exception{
		Bean jgxx = getBean();
		JGGLService.updateJGXX(jgxx);
	}
        
    /**
     * 初始化机构信息
     * @throws Exception 
     */
    @Before(RapidDbConn.class)
    public void cshjgxx() throws Exception{
    	String sjjgid = getPara("sjjgid");
        List<Bean> jgList = JGGLService.findJGXXListForTree(sjjgid);
        setJson(jgList); 
    }
	
}
